<template>
	<view class="page">
		<mescroll-uni @init="mescrollInit" top="24" @down="downCallback" :up="upOption" @up="upCallback"
			@emptyclick="emptyClick">
			<view class="items" v-for="data in dataList" @click="fenqi(data)">
				<view class="items_title" >
					{{data.name}}
				</view>
			</view>
		</mescroll-uni>


	</view>
</template>

<script>
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
import loginVue from "../ge_ren_zhong_xin/xiao_shou_mine/login.vue";
	export default {
		mixins: [MescrollMixin],

		data() {
			return {}
		},
		data() {
			return {
				areaId:null,
				Words: '', //搜索的关键字
				upOption: {
					noMoreSize: 10, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认10,
				},
				top: "24rpx",
				pager: {
					currentPage: 1,
					maxResultCount: 10
				},
				dataList: [],
			}
		},
		onLoad(val) {
			this.areaId = val.data
			this.getList()
		},
		methods: {

			async getList() {
				//获取练习列表数据
				const res = await this.$post(`/biz/wxInstallment/getAreas`, {
					current: this.pager.currentPage,
					size: this.pager.maxResultCount,
					FindKeyWords: this.Words,
					areaId: this.areaId
				})
				
				if (res.data.data.result.total >= 0) {
					if (this.pager.currentPage == 1) {
						this.dataList = []
					}
					this.dataList = this.dataList.concat(res.data.data.result.records)
				}
				this.mescroll.endBySize(res.data.data.result.size, res.data.data.total)
			},
			/*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
			upCallback(page) {
				this.pager.currentPage = page.num; //在第几页
				this.pager.maxResultCount = page.size; //展示多少条数据
				this.getList()
			},
			downCallback(page) { // 下拉刷新
				this.mescroll.resetUpScroll();
			},
			fenqi(val) {
	
				let pages = getCurrentPages()
				let prevPage = pages[pages.length - 3]
				prevPage.$vm.BuyingAcarTips = val.name
				prevPage.$vm.form.areaId = val.areaId
				uni.navigateBack({
					delta: 2
				})
			}

		}
	}
</script>

<style>
	.page {
		overflow-y: auto;
		width: 100%;
		height: 100vh;
		background-color: #fff;
	}

	.items {
		padding: 0 18rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: flex-start;
		width: 690rpx;
		height: 86rpx;
		margin: 0 auto 0;
		border-bottom: 2rpx solid #F4F4FA;
	}

	.items_title {
		height: 37rpx;
		font-size: 26rpx;
		font-family: 'PingFang SC-Regular, PingFang SC';
		font-weight: 400;
		color: #1A1824;
		line-height: 37rpx;
	}
</style>
